/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package ufrgs.inf.delphos.extraction.model.impl;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENamedElementImpl;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import ufrgs.inf.delphos.extraction.model.DAnnotation;
import ufrgs.inf.delphos.extraction.model.DAnnotationType;
import ufrgs.inf.delphos.extraction.model.DelphosSystemModelPackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>DAnnotation</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link ufrgs.inf.delphos.extraction.model.impl.DAnnotationImpl#getAnnotationType <em>Annotation Type</em>}</li>
 *   <li>{@link ufrgs.inf.delphos.extraction.model.impl.DAnnotationImpl#getMappedAtributes <em>Mapped Atributes</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class DAnnotationImpl extends ENamedElementImpl implements DAnnotation {
	/**
	 * The default value of the '{@link #getAnnotationType() <em>Annotation Type</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getAnnotationType()
	 * @generated
	 * @ordered
	 */
	protected static final DAnnotationType ANNOTATION_TYPE_EDEFAULT = DAnnotationType.PERMIT_ALL;
	/**
	 * The cached value of the '{@link #getAnnotationType() <em>Annotation Type</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getAnnotationType()
	 * @generated
	 * @ordered
	 */
	protected DAnnotationType annotationType = ANNOTATION_TYPE_EDEFAULT;
	/**
	 * The cached value of the '{@link #getMappedAtributes() <em>Mapped Atributes</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getMappedAtributes()
	 * @generated
	 * @ordered
	 */
	protected EList mappedAtributes;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected DAnnotationImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return DelphosSystemModelPackage.Literals.DANNOTATION;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public DAnnotationType getAnnotationType() {
		return annotationType;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setAnnotationType(DAnnotationType newAnnotationType) {
		DAnnotationType oldAnnotationType = annotationType;
		annotationType = newAnnotationType == null ? ANNOTATION_TYPE_EDEFAULT : newAnnotationType;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, DelphosSystemModelPackage.DANNOTATION__ANNOTATION_TYPE, oldAnnotationType, annotationType));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList getMappedAtributes() {
		return mappedAtributes;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setMappedAtributes(EList newMappedAtributes) {
		EList oldMappedAtributes = mappedAtributes;
		mappedAtributes = newMappedAtributes;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, DelphosSystemModelPackage.DANNOTATION__MAPPED_ATRIBUTES, oldMappedAtributes, mappedAtributes));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case DelphosSystemModelPackage.DANNOTATION__ANNOTATION_TYPE:
				return getAnnotationType();
			case DelphosSystemModelPackage.DANNOTATION__MAPPED_ATRIBUTES:
				return getMappedAtributes();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case DelphosSystemModelPackage.DANNOTATION__ANNOTATION_TYPE:
				setAnnotationType((DAnnotationType)newValue);
				return;
			case DelphosSystemModelPackage.DANNOTATION__MAPPED_ATRIBUTES:
				setMappedAtributes((EList)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case DelphosSystemModelPackage.DANNOTATION__ANNOTATION_TYPE:
				setAnnotationType(ANNOTATION_TYPE_EDEFAULT);
				return;
			case DelphosSystemModelPackage.DANNOTATION__MAPPED_ATRIBUTES:
				setMappedAtributes((EList)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case DelphosSystemModelPackage.DANNOTATION__ANNOTATION_TYPE:
				return annotationType != ANNOTATION_TYPE_EDEFAULT;
			case DelphosSystemModelPackage.DANNOTATION__MAPPED_ATRIBUTES:
				return mappedAtributes != null;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (annotationType: ");
		result.append(annotationType);
		result.append(", mappedAtributes: ");
		result.append(mappedAtributes);
		result.append(')');
		return result.toString();
	}

} //DAnnotationImpl
